package com.hopu.petshop.controller.old;//package com.hopu.petshop.controller;
//
//import com.hopu.petshop.entity.Pet;
//import com.hopu.petshop.service.PetService;
//
//import javax.servlet.ServletException;
//import javax.servlet.annotation.WebServlet;
//import javax.servlet.http.HttpServlet;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.sql.SQLException;
//
///**
// * 更新宠物的Servlet
// */
//@WebServlet("/modifyPet.do")
//public class ModifyPetServlet extends HttpServlet {
//
//    //用spring创建service对象
//    private PetService petService = SpringConfig.getContext().getBean(PetService.class);
//
//    @Override
//    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        String id = req.getParameter("id");
//        String name = req.getParameter("name");
//        String age = req.getParameter("age");
//        String gender = req.getParameter("gender");
//        String color = req.getParameter("color");
//        String price = req.getParameter("price");
//        String typeId = req.getParameter("typeId");
////        String userId = req.getParameter("userId");
//        //调用service添加宠物
//        try {
//            petService.modifyPetById(new Pet(Integer.valueOf(id),name,Integer.valueOf(age),color,gender,Integer.valueOf(price),Integer.valueOf(typeId),null));
//            System.out.println("更新成功！");
//            resp.sendRedirect("/findPetsPage.do");
//        } catch (SQLException e) {
//            e.printStackTrace();
//        }
//    }
//
//    @Override
//    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        doGet(req,resp);
//    }
//}
